home *** CD-ROM | disk | FTP | other *** search
- /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Copyright (C) 1994, by WATCOM International Inc. All rights %
- % reserved. No part of this software may be reproduced or %
- % used in any form or by any means - graphic, electronic or %
- % mechanical, including photocopying, recording, taping or %
- % information storage and retrieval systems - except with the %
- % written permission of WATCOM International Inc. %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- */
-
- #ifndef _WOLEAUTO_HPP_INCLUDED
- #define _WOLEAUTO_HPP_INCLUDED
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma pack(push,8);
- #pragma enum int;
- #endif
-
- #include <stdarg.h>
- #ifndef _WOLETYPE_HPP_INCLUDED
- # include "woletype.hpp"
- #endif
- #ifndef _WSTRING_HPP_INCLUDED
- # include "wstring.hpp"
- #endif
- #ifndef _WOLEBSTR_HPP_INCLUDED
- # include "wolebstr.hpp"
- #endif
- #ifndef _WBUFFER_HPP_INCLUDED
- # include "wbuffer.hpp"
- #endif
- #ifndef _WARRAY_HPP_INCLUDED
- # include "warray.hpp"
- #endif
-
- enum WAmbientID {
- WAmbient_BACKCOLOR = (-701)
- , WAmbient_DISPLAYNAME = (-702)
- , WAmbient_FONT = (-703)
- , WAmbient_FORECOLOR = (-704)
- , WAmbient_LOCALEID = (-705)
- , WAmbient_MESSAGEREFLECT = (-706)
- , WAmbient_SCALEUNITS = (-707)
- , WAmbient_TEXTALIGN = (-708)
- , WAmbient_USERMODE = (-709)
- , WAmbient_UIDEAD = (-710)
- , WAmbient_SHOWGRABHANDLES = (-711)
- , WAmbient_SHOWHATCHING = (-712)
- , WAmbient_DISPLAYASDEFAULT = (-713)
- , WAmbient_SUPPORTSMNEMONICS = (-714)
- , WAmbient_AUTOCLIP = (-715)
- };
-
- enum WDispatchFlag {
- WDispatchFlag_Method = 0x1
- , WDispatchFlag_PropertyGet = 0x2
- , WDispatchFlag_PropertyPut = 0x4
- , WDispatchFlag_PropertyPutRef = 0x8
- };
-
- enum WInvokeError {
- WInvokeError_None
- , WInvokeError_HelperNotInitialized
- , WInvokeError_NoErrorInfo
- , WInvokeError_CallNotMade
- , WInvokeError_OutOfMemory
- , WInvokeError_TooManyParams
- , WInvokeError_BadNamedParam
- , WInvokeError_BadParamCount
- , WInvokeError_BadParamArray
- , WInvokeError_BadVarType
- , WInvokeError_Exception
- , WInvokeError_MemberNotFound
- , WInvokeError_Overflow
- , WInvokeError_ParamNotFound
- , WInvokeError_TypeMismatch
- , WInvokeError_Error
- };
-
- /*************************************************************************
- *
- * WExceptionInfo -- Exception Information
- *
- *
- * Events:
- *
- *
- *************************************************************************/
-
- class WCMCLASS WExceptionInfo {
-
- public:
-
- /**********************************************************
- * Constructors and Destructors
- *********************************************************/
- WExceptionInfo();
- WExceptionInfo( const WExceptionInfo & excep );
- WExceptionInfo( WPIErrorInfo pErrorInfo );
- ~WExceptionInfo();
-
- public:
-
- /**************************************************************
- * Properties
- **************************************************************/
-
- // WCode
- WBool SetWCode( WUShort wcode );
- WUShort GetWCode() const;
-
- // Scode
- WBool SetSCode( WScode scode );
- WScode GetSCode() const;
-
- // Description
- WBool SetDescription( const WString & description );
- WString GetDescription() const;
-
- // Help File
- WBool SetHelpFile( const WString & helpFile );
- WString GetHelpFile() const;
-
- // Source
- WBool SetSource( const WString & source );
- WString GetSource() const;
-
- // Help Context
- WBool SetHelpContext( WULong helpContext );
- WULong GetHelpContext() const;
-
- // GUID
- WBool SetGUID( const WGUID & guid );
- WGUID GetGUID() const;
-
- // ExceptionInfo
- WBool SetExceptionInfo( void );
- WBool GetExceptionInfo( WPIDispatch disp );
-
- /**************************************************************
- * Methods
- **************************************************************/
-
- WBool Create( WPIErrorInfo pErrorInfo );
-
- void Display( void );
-
- static WBool ClearExceptionInfo( void );
-
- /**********************************************************
- * Operators
- *********************************************************/
-
- WExceptionInfo & operator=( const WExceptionInfo & excep );
-
- private:
-
- /**********************************************************
- * Data Members
- *********************************************************/
-
- WUShort _wCode;
- WScode _scode;
- WString _source;
- WString _description;
- WString _helpFile;
- WULong _helpContext;
- WGUID _guid;
- };
-
-
- enum WVarEnum {
- WVT_EMPTY = 0,
- WVT_NULL = 1,
- WVT_I2 = 2,
- WVT_I4 = 3,
- WVT_R4 = 4,
- WVT_R8 = 5,
- WVT_CY = 6,
- WVT_DATE = 7,
- WVT_BSTR = 8,
- WVT_DISPATCH = 9,
- WVT_ERROR = 10,
- WVT_BOOL = 11,
- WVT_VARIANT = 12,
- WVT_UNKNOWN = 13,
- WVT_I1 = 16,
- WVT_UI1 = 17,
- WVT_UI2 = 18,
- WVT_UI4 = 19,
- WVT_I8 = 20,
- WVT_UI8 = 21,
- WVT_INT = 22,
- WVT_UINT = 23,
- WVT_VOID = 24,
- WVT_HRESULT = 25,
- WVT_PTR = 26,
- WVT_SAFEARRAY = 27,
- WVT_CARRAY = 28,
- WVT_USERDEFINED = 29,
- WVT_LPSTR = 30,
- WVT_LPWSTR = 31,
- WVT_FILETIME = 64,
- WVT_BLOB = 65,
- WVT_STREAM = 66,
- WVT_STORAGE = 67,
- WVT_STREAMED_OBJECT = 68,
- WVT_STORED_OBJECT = 69,
- WVT_BLOB_OBJECT = 70,
- WVT_CF = 71,
- WVT_CLSID = 72,
-
- // extensions for ole controls
- WVT_COLOR = WVT_I4,
- WVT_XPOS_PIXELS = WVT_I4,
- WVT_YPOS_PIXELS = WVT_I4,
- WVT_XSIZE_PIXELS = WVT_I4,
- WVT_YSIZE_PIXELS = WVT_I4,
- WVT_XPOS_HIMETRIC = WVT_I4,
- WVT_YPOS_HIMETRIC = WVT_I4,
- WVT_XSIZE_HIMETRIC = WVT_I4,
- WVT_YSIZE_HIMETRIC = WVT_I4,
- WVT_TRISTATE = WVT_I2,
- WVT_OPTEXCLUSIVE = WVT_BOOL,
- WVT_FONT = WVT_DISPATCH,
- WVT_PICTURE = WVT_DISPATCH,
-
- // 4 BYTE windows handle
- WVT_HANDLE = WVT_I4
- };
-
- #define WVT_VECTOR (0x1000)
- #define WVT_ARRAY (0x2000)
- #define WVT_BYREF (0x4000)
- #define WVT_RESERVED (0x8000)
-
- #define WDISP_E_PARAMNOTFOUND 0x80020004L
- #define WDISP_E_EXCEPTION 0x80020009L
- #define W_INV_ALL_PARAMS 0xffffffff
-
- typedef unsigned short WVarType;
-
- // forward type declaration
- struct _WVARIANT;
-
- typedef struct _WVARIANT {
-
- /**********************************************************
- * Data Members
- *********************************************************/
-
- WVarType vt;
- unsigned short wReserved1;
- unsigned short wReserved2;
- unsigned short wReserved3;
- union
- {
- unsigned char bVal; /* WVT_UI1 */
- short iVal; /* WVT_I2 */
- long lVal; /* WVT_I4 */
- float fltVal; /* WVT_R4 */
- double dblVal; /* WVT_R8 */
- WVARIANT_BOOL boolVal; /* WVT_BOOL */
- WScode scode; /* WVT_ERROR */
- WCurrency cyVal; /* WVT_CY */
- WDate date; /* WVT_DATE */
- WBStr bstrVal; /* WVT_BSTR */
- WPIUnknown punkVal; /* WVT_UNKNOWN */
- WPIDispatch pdispVal; /* WVT_DISPATCH */
- WSafeArray *parray; /* WVT_ARRAY|* */
- unsigned char *pbVal; /* WVT_BYREF|WVT_UI1 */
- short *piVal; /* WVT_BYREF|WVT_I2 */
- long *plVal; /* WVT_BYREF|WVT_I4 */
- float *pfltVal; /* WVT_BYREF|WVT_R4 */
- double *pdblVal; /* WVT_BYREF|WVT_R8 */
- WVARIANT_BOOL *pboolVal; /* WVT_BYREF|WVT_BOOL */
- WScode *pscode; /* WVT_BYREF|WVT_ERROR */
- WCurrency *pcyVal; /* WVT_BYREF|WVT_CY */
- WDate *pdate; /* WVT_BYREF|WVT_DATE */
- WBStr *pbstrVal; /* WVT_BYREF|WVT_BSTR */
- WPIUnknown *ppunkVal; /* WVT_BYREF|WVT_UNKNOWN */
- WPIDispatch *ppdispVal; /* WVT_BYREF|WVT_DISPATCH */
- WSafeArray **pparray; /* WVT_BYREF|WVT_ARRAY|* */
- _WVARIANT *pvarVal; /* WVT_BYREF|WVT_VARIANT */
- void *byref; /* Generic ByRef */
-
- // WClass extras
- unsigned short uiVal; /* WVT_UI2 */
- unsigned long ulVal; /* WVT_UI4 */
- char cVal; /* WVT_I1 */
- unsigned int uintVal; /* WVT_UINT */
- int intVal; /* WVT_INT */
- char *pcVal; /* WVT_BYREF|WVT_I1 */
- unsigned short *puiVal; /* WVT_BYREF|WVT_UI2 */
- unsigned long *pulVal; /* WVT_BYREF|WVT_UI4 */
- unsigned int *puintVal; /* WVT_BYREF|WVT_UINT */
- int *pintVal; /* WVT_BYREF|WVT_INT */
- WBString *pwbstringVal;
- };
- } _WVARIANT;
-
-
- typedef _WVARIANT WVARIANT;
-
- class WVariant;
-
- extern template WArrayReference<WVariant>;
- extern template WArray<WVariant>;
-
- typedef WArray<WVariant> WVariantArray;
-
- /*************************************************************************
- *
- * WVariant
- *
- *
- * Events:
- *
- *
- *************************************************************************/
-
- // The contents of this class are not managed in any way.
- // This means that no attempt is made to call Release through
- // interface pointers, etc. The only exception to this rule are
- // strings.
- class WCMCLASS WVariant : public _WVARIANT {
-
- public:
-
- /**********************************************************
- * Constructors and Destructors
- *********************************************************/
-
- WVariant( void );
- WVariant( unsigned char b );
- WVariant( short s );
- WVariant( long l );
- WVariant( float flt );
- WVariant( double dbl );
- WVariant( WCurrency cy );
- WVariant( WBStr bstr );
- WVariant( WPIUnknown punk );
- WVariant( WPIDispatch pdisp );
- WVariant( WSafeArray *p );
- WVariant( unsigned char *pb );
- WVariant( short *pi );
- WVariant( long *pl );
- WVariant( float *pflt );
- WVariant( double *pdbl );
- WVariant( WCurrency *pcy );
- WVariant( WBStr *pbstr );
- WVariant( WPIUnknown *ppunk );
- WVariant( WPIDispatch *ppdisp );
- WVariant( WSafeArray **ppa );
- WVariant( WVariant *pvar );
- WVariant( unsigned short ui );
- WVariant( unsigned long ul );
- WVariant( char c );
- WVariant( unsigned int ui );
- WVariant( int i );
- WVariant( unsigned short *pui );
- WVariant( unsigned long *pul );
- WVariant( unsigned int *puint );
- WVariant( int *pint );
-
- // Ambiguous with short:
- // WVariant( WVARIANT_BOOL b ) { vt = WVT_BOOL; boolVal = b; freeMember = isWBString = FALSE; SetReserved(); };
- // Ambiguous with long:
- // WVariant( WScode sc ) { vt = WVT_ERROR; scode = sc; freeMember = isWBString = FALSE; SetReserved(); };
- // Ambiguous with double:
- // WVariant( WDate dt ) { vt = WVT_DATE; date = dt; freeMember = isWBString = FALSE; SetReserved(); };
- // Ambiguous with short *:
- // WVariant( WVARIANT_BOOL *pb ){ vt = WVT_BYREF|WVT_BOOL; pboolVal = pb; freeMember = isWBString = FALSE; SetReserved(); };
- // Ambiguous with long *:
- // WVariant( WScode *psc ) { vt = WVT_BYREF|WVT_ERROR; pscode = psc; freeMember = isWBString = FALSE; SetReserved(); };
- // Ambiguous with double *:
- // WVariant( WDate *pdt ) { vt = WVT_BYREF|WVT_DATE; pdate = pdt; freeMember = isWBString = FALSE; SetReserved(); }
-
- // Amibiguous the the string constructors.
- // WVariant( char *pc ) { vt = WVT_BYREF|WVT_I1; pcVal = pc; freeMember = isWBString = FALSE; SetReserved(); };
-
- WVariant( const WChar * const str );
-
- // The following constuctor sets freeMember to TRUE and
- // cause BSTR's to be allocated NOT pointers to WStrings.
- WVariant( const WString & str );
- WVariant( const WBString & wbstr );
-
- // Copy constructor. This member will cause BSTR's or WString pointers
- // to be allocated instead of copied if freeMember is TRUE
- WVariant( const WVariant & var );
-
- WVariant( const _WVARIANT & var );
-
- // WBuffer constructor. This member will cause a BSTR to be allocated
- WVariant( const WBuffer & buffer );
-
- // WVariantArray constructor. This member will cause a
- // SAFEARRAY of VARIANTS to be allocated
- WVariant( WVariantArray & variantArray );
-
- ~WVariant();
-
- /**************************************************************
- * Methods
- **************************************************************/
-
- void Init( void );
- WBool Clear( void );
- WBool ChangeType( const WVarType vtNew );
- WBool ChangeType( WVariant & dest, const WVarType vtNew );
-
- // NOTE: If vt is WVT_BSTR then the argument is a WString *
- WBool Assign( void * val, WVarType type );
-
- // NOTE: If vtSet is WVT_BSTR then the argument is expected to
- // be a WChar *
- WBool Set( const WVarType vtSet, va_list arg );
-
- WBool BStrToWBString( void );
- WBool WBStringToBStr( void );
- WBool IsWBString();
-
- /**************************************************************
- * Internal Methods
- **************************************************************/
-
- void SetReserved( void );
-
- /**************************************************************
- * Operators
- **************************************************************/
-
- WVariant & operator=( const WVariant & var );
-
- // cast operators
-
- operator unsigned char() const;
- operator short() const;
- operator long() const;
- WCMRETURNSFLOAT operator float() const;
- WCMRETURNSFLOAT operator double() const;
- //operator WVARIANT_BOOL() const;
- //operator WScode() const;
- operator WCurrency() const;
- //operator WDate() const;
- //operator WBStr();
- operator WString();
- operator WBString();
- operator WBuffer();
- operator WPIUnknown() const;
- operator WPIDispatch() const;
- operator WSafeArray *() const;
-
- operator unsigned char *() const;
- operator short *() const;
- operator long *() const;
- operator float *() const;
- operator double *() const;
- //operator WVARIANT_BOOL *() const;
- //operator WScode *() const;
- operator WCurrency *() const;
- //operator WDate *() const;
- operator WBStr *() const;
- operator WPIUnknown *() const;
- operator WPIDispatch *() const;
- operator WSafeArray **() const;
- operator _WVARIANT *() const;
- operator void *() const;
-
- operator unsigned short() const;
- operator unsigned long() const;
- operator char() const;
- operator unsigned int() const;
- operator int() const;
- //operator char *() const;
- operator unsigned short *() const;
- operator unsigned long *() const;
- operator unsigned int *() const;
- operator int *() const;
- operator WBString *();
-
- /**********************************************************
- * Data Members
- *********************************************************/
-
- private:
- WBool freeMember;
- WBool isWBString;
-
- };
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma enum pop;
- #pragma pack(pop);
- #endif
-
- #endif // _WOLEAUTO_HPP_INCLUDED
-